import request from '@/utils/request'

export default {

  /**
   * 查询所有角色
   * @returns {AxiosPromise}
   */
  queryAllROle() {
    return request({
      url: `/auth/auth/auth-role/queryAll`,
      method: 'get'
    })
  },

  /***
   * 添加角色
   * @param data
   * @returns {AxiosPromise}
   */
  addRole(data) {
    return request({
      url: `/auth/auth/auth-role/addRole`,
      method: 'post',
      data: data
    })
  },
  /**
   * 给角色分配菜单
   * @param data
   * @returns {AxiosPromise}
   */
  roleBindingMenu(data) {
    return request({
      url: `/auth/auth/auth-role/roleBindingMenu`,
      method: 'post',
      data: data
    })
  },
  /**
   * 岗位绑定角色
   * @param data
   * @returns {AxiosPromise}
   */
  stationBindingRole(data) {
    return request({
      url: `/auth/auth/auth-role/stationBindingRole`,
      method: 'post',
      data: data
    })
  },
  /**
   * 根据角色id查询对应的菜单信息
   * @param roleId
   * @returns {AxiosPromise}
   */
  queryMenuBaseOnRoleId(roleId) {
    return request({
      url: `/auth/auth/auth-menu/queryMenuBaseOnRoleId/${roleId}`,
      method: 'get'
    })
  },
  /**
   * 根据角色Id查询对应的岗位
   * @param roleId
   * @returns {AxiosPromise}
   */
  getStationBasedOnRoleId(roleId) {
    return request({
      url: `/auth/auth/auth-role/getStationBasedOnRoleId/${roleId}`,
      method: 'get'
    })
  }
}
